Repository navigation
fix: keep confirmation danger buttons solid in the dark theme - #303
Merged
Merged
Conversation
Confirmation buttons combine the destructive Button variant with DANGER_BUTTON_CLASS. The variant sets dark:bg-destructive/20, which tailwind-merge keeps because DANGER_BUTTON_CLASS only sets the unprefixed bg-destructive. In the dark theme the button was a 20% red tint with the near-black --destructive-foreground label, so it looked disabled. DANGER_BUTTON_CLASS now sets the dark fill and hover fill too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
In the dark theme, the Confirm button of delete confirmations looks disabled. These buttons combine the
destructiveButton variant withDANGER_BUTTON_CLASS. The variant setsdark:bg-destructive/20, and tailwind-merge keeps it becauseDANGER_BUTTON_CLASSonly sets the unprefixedbg-destructive. So in the dark theme the button is a 20% red tint over the dialog, with the near-black--destructive-foregroundlabel meant for a solid fill.DANGER_BUTTON_CLASSnow also setsdark:bg-destructiveanddark:hover:bg-destructive/95, which replace the variant's dark tint when merged. This affects the confirmations incomponents/dialog-host.tsx(bucket, policy, user and other deletes) and the object delete and force cleanup dialogs incomponents/object/list.tsx. The light theme is unchanged.Type of Change
Testing
tests/lib/danger-button-dark.test.tsmerges thedestructivevariant classes withDANGER_BUTTON_CLASSthroughcnand checks the dark fill and hover fill. Negative control: with the oldDANGER_BUTTON_CLASS, both checks fail.oklab(0.714 0.172 0.055 / 0.2)with labelrgb(11, 14, 20); after:rgb(255, 107, 120)with the same label. Light theme before and after:rgb(197, 27, 50)with a white label.Checklist
Related Issues
No linked issue.
Screenshots (if applicable)
Before (dark theme):
After (dark theme):
Additional Notes
The SSE page uses
DANGER_BUTTON_CLASSon default-variant buttons, which set no dark fill, so they were not affected.